'''
Company: TWL
Author: xue jian
Email: xuejian@kanzhun.com
Date: 2020-11-06 14:57:53
'''
#
# @lc app=leetcode.cn id=49 lang=python3
#
# [49] 字母异位词分组
#

# @lc code=start
from typing import List
class Solution:
    def groupAnagrams(self, strs: List[str]) -> List[List[str]]:
        import collections
        store = collections.defaultdict(list)
        for s in strs:
            tmp = ''.join(sorted(list(s)))
            store[tmp].append(s)
        ans = []
        for _, v in store.items():
            ans.append(v)
        return ans

# @lc code=end

